package com.wenwan.manage.controller;

import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.wenwan.manage.service.GoodsCategoryFirstService;

import javax.annotation.Resource;

/**
 * 商品一级类目
 * 
 * @author Admin
 *
 */
@Controller
@RequestMapping(value = "/goods/category/first")
public class GoodsCategoryFirstController {

	@Autowired
	private GoodsCategoryFirstService goodsCategoryFirstService;

	@ResponseBody
	@RequestMapping(value = "/create", method = { RequestMethod.POST, RequestMethod.GET })
	public Map<String, Object> create(@RequestParam(required = true) String name) {
		return goodsCategoryFirstService.create(name);
	}

	@ResponseBody
	@RequestMapping(value = "/update", method = { RequestMethod.POST })
	public Map<String, Object> update(@RequestParam(required = true) String id,
			@RequestParam(required = true) String name) {
		return goodsCategoryFirstService.update(id, name);
	}

	@ResponseBody
	@RequestMapping(value = "/delete/by/id", method = { RequestMethod.POST })
	public Map<String, Object> deleteById(@RequestParam(required = true) String id) {
		return goodsCategoryFirstService.deleteById(id);
	}

}
